package cn.sciento.transfer.api.eventhandler;

import cn.sciento.transfer.infra.rocketmq.service.MqConsumerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component
public class ApplicationStartListener implements ApplicationListener<ApplicationReadyEvent> {
  @Autowired
  private MqConsumerService mqConsumerService;
  
  public void onApplicationEvent(ApplicationReadyEvent event) {
    this.mqConsumerService.startAllConsumers();
  }
}
